Kanzi 4.0.0-beta2
kanzi::GlyphRun Class Reference

GlyphRun contains the memory structures that are needed to render a text string. More...

#include <kanzi/core.ui/text/glyph_run.hpp>

Public Member Functions

void allocateClippingCoordinates ()
 Allocates the space for the clipping coordinates.
 
void draw (Renderer &renderer, bool twoPass, GlRenderState &renderState)
 Renders the glyph run.
 
RectangleFloat getBoundingRectangle () const
 Returns the bounding box for the whole glyph run, with clipping.
 
RectangleFloat getCharacterBounds (size_t glyphRunIndex) const
 Returns the unclipped bounding box for the given glyph, as set by setCharacterBounds().
 
TextureSharedPtr getTexture () const
 Returns the glyph cache texture.
 
 GlyphRun (Domain *domain, size_t capacity, GlyphCache &glyphCache)
 Constructs a glyph run with given maximum capacity.
 
void setCharacterBounds (size_t glyphRunIndex, float left, float top, float right, float bottom)
 Sets the unclipped bounding box for a glyph at the given index.
 
void setClippingCoordinates (size_t glyphRunIndex, float left, float top, float right, float bottom)
 Sets the clipping coordinates for a glyph at the given index.
 
void setGlyph (unsigned int glyphRunIndex, const GlyphKey &glyphKey)
 Sets the font glyph index for the given glyph.
 
void setLength (unsigned int length)
 Sets the actual length of the glyph run.
 
void setVertexCoordinates (size_t glyphRunIndex, float left, float top, float right, float bottom)
 Sets the vertex coordinates for the given index, based on the given edges.
 
 ~GlyphRun ()=default
 Destructor.
 

Detailed Description

GlyphRun contains the memory structures that are needed to render a text string.

Constructor & Destructor Documentation

◆ GlyphRun()

kanzi::GlyphRun::GlyphRun ( Domain * domain,
size_t capacity,
GlyphCache & glyphCache )
explicit

Constructs a glyph run with given maximum capacity.

Parameters
domainDomain to use.
capacityDefines the maximum amount of glyphs that can be included in the run.
glyphCacheGlyph cache containing the characters.
Since
Kanzi 4.0.0
  • Changed the type of the capacity parameter to size_t.
  • Added the glyphCache parameter.

◆ ~GlyphRun()

kanzi::GlyphRun::~GlyphRun ( )
default

Destructor.

Member Function Documentation

◆ draw()

void kanzi::GlyphRun::draw ( Renderer & renderer,
bool twoPass,
GlRenderState & renderState )

Renders the glyph run.

Parameters
rendererRenderer to use for drawing.
twoPassTrue for separate color and depth render passes, false for a single pass.
renderStateRender State used for rendering.
Since
Kanzi 4.0.0
  • Changed the material parameter to renderState.
  • Changed the type of the renderer parameter to Renderer&.
  • Removed the glyphCache parameter.

◆ setVertexCoordinates()

void kanzi::GlyphRun::setVertexCoordinates ( size_t glyphRunIndex,
float left,
float top,
float right,
float bottom )

Sets the vertex coordinates for the given index, based on the given edges.

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
leftLeft edge x axis coordinate.
topTop edge y axis coordinate.
rightRight edge x axis coordinate.
bottomBottom edge y axis coordinate.
Since
Kanzi 4.0.0 changed the type of the glyphRunIndex parameter to size_t.

◆ setCharacterBounds()

void kanzi::GlyphRun::setCharacterBounds ( size_t glyphRunIndex,
float left,
float top,
float right,
float bottom )

Sets the unclipped bounding box for a glyph at the given index.

Used to calculate final clipped vertex coordinates.

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
leftLeft edge x axis coordinate.
topTop edge y axis coordinate.
rightRight edge x axis coordinate.
bottomBottom edge y axis coordinate.
Since
Kanzi 4.0.0 changed the type of the glyphRunIndex parameter to size_t.

◆ setClippingCoordinates()

void kanzi::GlyphRun::setClippingCoordinates ( size_t glyphRunIndex,
float left,
float top,
float right,
float bottom )

Sets the clipping coordinates for a glyph at the given index.

For each quad there are 4 floats in range[0, 1]: left, right, bottom, and top. For example, a left value of 0.1 and a right value of 0.25 means that one tenth of the glyph is being clipped from the left side and a quarter of the glyph is being clipped from the right side.

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
leftLeft edge clipping amount.
topTop edge clipping amount.
rightRight edge clipping amount.
bottomBottom edge clipping amount.
Since
Kanzi 4.0.0 changed the type of the glyphRunIndex parameter to size_t.

◆ setGlyph()

void kanzi::GlyphRun::setGlyph ( unsigned int glyphRunIndex,
const GlyphKey & glyphKey )

Sets the font glyph index for the given glyph.

Use this function to retrieve texture coordinates.

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
glyphKeyGlyphKey of the glyph in the used font.

◆ setLength()

void kanzi::GlyphRun::setLength ( unsigned int length)

Sets the actual length of the glyph run.

Parameters
lengthLength of the run. The length must be smaller than or equal to the available length.

◆ allocateClippingCoordinates()

void kanzi::GlyphRun::allocateClippingCoordinates ( )

Allocates the space for the clipping coordinates.

◆ getBoundingRectangle()

RectangleFloat kanzi::GlyphRun::getBoundingRectangle ( ) const

Returns the bounding box for the whole glyph run, with clipping.

Returns
Bounding box containing all the glyphs.

◆ getCharacterBounds()

RectangleFloat kanzi::GlyphRun::getCharacterBounds ( size_t glyphRunIndex) const

Returns the unclipped bounding box for the given glyph, as set by setCharacterBounds().

Parameters
glyphRunIndexIndex of the glyph in the glyph run.
Returns
Bounding box for the glyph.
Since
Kanzi 4.0.0 changed the type of the glyphRunIndex parameter to size_t.

◆ getTexture()

TextureSharedPtr kanzi::GlyphRun::getTexture ( ) const

Returns the glyph cache texture.

Returns
The texture of the glyph cache.
Since
Kanzi 4.0.0

The documentation for this class was generated from the following file: